﻿using System.ComponentModel;
using DevExpress.XtraEditors;
using Dictionary.ERP;
using System.Windows.Forms;
using Extra.ERP;
using Common.Class;

namespace Dictionary
{
    public class xfmStep : XtraForm
    {
        public delegate void ItemSelectedEventHander(object sender, HRM_DEPARTMENT item);

        private bool _search;
        private IContainer components;
        private xucStep xucstep;

        public xfmStep()
        {
            components = null;
            _search = false;
            InitializeComponent();
            Init();
        }

        public xfmStep(bool search)
        {
            components = null;
            _search = false;
            _search = search;
            InitializeComponent();
            Init();
        }

        public bool IsSearch
        {
            set { xucstep.IsSearch = value; }
        }

        public event ItemSelectedEventHander ItemSelected;

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Init()
        {
            SYS_LOG.Insert("Danh Mục Bậc Lương", "Xem");
            xucstep = new xucStep();
            base.Controls.Add(xucstep);
            xucstep.Dock = DockStyle.Fill;
            xucstep.CloseClick += new ButtonClickEventHander(xucstep_CloseClick);
            Text = (SysOption.Language == "EN") ? "Step" : Text;
        }

        private void InitializeComponent()
        {
            components = new Container();
            base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            Text = "xfmStep";
        }

        private void RaiseItemSelectedEventHander(HRM_DEPARTMENT item)
        {
            if (ItemSelected != null)
            {
                ItemSelected(this, item);
            }
        }

        private void xucstep_CloseClick(object sender)
        {
            base.Close();
        }
    }
}